﻿using PLCS.Application.Contracts.TrayApp.Dtos;
using PLCS.Shared.Common.Constant;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace PLCS.App.Converts
{
    public class TraysConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return null;
            var res = value as List<TrayDto>;
            if (res == null) return null;
            var resString = res.Select(x => x.TrayNo);
            return string.Join(ConstantChar.SplitChar, resString);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}